<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="../../css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/main.css" />

    <link rel="stylesheet" type="text/css" href="../../css/colleague.css" />

    <script type="text/javascript" src="../../script/api.js"></script>
    <script type="text/javascript" src="../../script/jquery.js"></script>

    <script type="text/javascript" src="../../script/main.js"></script>
</head>
<body>
  <div id="header">
      <div id="back"></div>
      <h3>发布新通知</h3>
  </div>
  <div id="all" style="height:500px;">
    <div class="feedback">
      <div class="feedback_span"><span>发布新通知</span></div>
      <div class="choose_type"><span>选择分类</span><select><option>AllPots</option><option>php</option><option>java</option><option>javascript</option><option>c语言</option><option>云计算</option><option>大数据-hadoop技术</option><option>移动应用</option></select></div>
      <div class="feedback_content">
        <div class="feedback_content_span">
          <textarea name="feedback_content_span_text" placeholder="您发布的通知将被置顶" class="text_content"></textarea>
        </div>
      </div>
    </div>
  </div>
  <footer>
    <button class="myBtn">提交</button>
  </footer>

</body>
<script>
  apiready=function(){

  }
  $(function(){
    back();

    //发布通知
    $(".myBtn").click(function(){
      if($(".text_content").val()==""){
        toast("消息不能为空","middle");
      }else{
        var type=0;
        if($("select").val()=='php'){
          type=1;
        }
        if($("select").val()=='java'){
          type=2;
        }
        if($("select").val()=='javascript'){
          type=3;
        }
        if($("select").val()=='c语言'){
          type=4;
        }
        if($("select").val()=='云计算'){
          type=5;
        }
        if($("select").val()=='大数据-hadoop技术'){
          type=6;
        }
        if($("select").val()=='移动应用'){
          type=7;
        }
        var url='/api/annunciates';
        var data={
            "content": $(".text_content").val(),
            "type":type,
            "createTime": formatDate(new Date(), 'yyyy-MM-ddTHH:mm:ssZ')
          };
        var functionRet=function(ret){
          alert("发布成功");
          api.execScript({
            name: 'notice_list',
            script: 'history.go(0)'
        });
        api.execScript({
          name: 'root',
          frameName: 'frame2',
          script: 'history.go(0)'
        });
          closeWin();
        }
        var functionErr=function(err){
          alert(JSON.stringify(err))
        }
        post(url,data,functionRet,functionErr)
      }
    });
  })
</script>
</html>
